#!/bin/bash
# 创建有密码的rar zip文件  rar a -pabc -r down_passwd down_img/*    zip -rP abc xmind-8-linux_passwd.zip xmind-8-linux/*
# file="/tmp/down_passwd.rar"
file="/tmp/xmind-8-linux_passwd.zip"
save="/tmp/down_passwd/"
# $status=`rar e -p- ${file} ${save}`
# if [ $? !=0 ]
#  then
#    echo 123
# fi

# rar有密码测试
# encryptedfiles=`rar va ${file} | grep -A1000 '\-\-\-\-\-' | grep -B1000  '\-\-\-\-\-'|grep '^\*'|wc -l`
# if [ ${encryptedfiles} != 0 ]; then
#     # TODO 添加log rar文件有密码，处理失败
#     echo 123
#     # echo "${INO_FILE} need password" | tee -a $errorlog
#     # continue
# fi
# zip有密码测试
unzip -q -o -O cp936 -P passwork ${file} -d ${save}
if [ $? != 0 ]; then
  echo 123
  # rm -rf ${deal_file_path}${file_name}
  # echo "${INO_FILE} unzip error or the file not is a zipfile or the need password or the file is bad zipfile" | tee -a ${errorlog}
  # continue
fi
